#include "lib/includes.h"

U08  gCmdBuffer[260];                  
U08  gpRcvBuffer[260];

U32  Grcv_Len;
FILE *LogFile;

void errmsg( const char *format, ... )
{
    va_list arglist;
    time_t rawtime;
    struct tm* timeinfo;
    char buffer[80];
    time(&rawtime);
    timeinfo = localtime(&rawtime);
    //printf( "It is now: %s", ctime( &time_of_day ) );
    strftime(buffer,sizeof(buffer),"[%Y-%m-%d %H:%M:%S]",timeinfo);
    fprintf( stderr, "%s Warning: ", buffer);
    va_start( arglist, format );
    vfprintf( stderr, format, arglist );
    va_end( arglist );
    if( LogFile != NULL )
    {
       fprintf( LogFile, "%s Warning: ", buffer);
       va_start( arglist, format );
       vfprintf( LogFile, format, arglist );
       va_end( arglist );
       fflush( LogFile );
    }
}

void Com_Hook_DebugOutHex( unsigned char *data, unsigned int datalen )
{
    unsigned int i=0;
    for(i =0; i < datalen; i++)
    {
        printf("%02x",data[i]);
    }
    printf("\r\n");
}

void Com_Hook_DebugOutAscii( unsigned char *data, unsigned int datalen )
{
    printf("%s\n",data);
}

